<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
		  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" th:href="@{/base/login/assets/css/reset.css}"/>
<link rel="stylesheet" th:href="@{/base/login/assets/css/supersized.css}"/>
<link rel="stylesheet" th:href="@{/base/login/assets/css/style.css}"/>   
<link rel="stylesheet" type="text/css" th:href="@{/base/login/css/styles.css}"/>
<title>login</title>
</head>

<body>
        <div class="page-container">	           
		<div class="wrapper">	
			<div class="container">
				<strong><span style="font-weight: bold;font-size: 25px;">登  录</span></strong> 
				<form class="form layui-form"  method="post">
					<input type="text" id="username" lay-verify="required"  name="username" placeholder="Username">
					<input type="password" lay-verify="required" id="password"  name="password"  placeholder="Password">
					<button type="submit"  lay-submit lay-filter="login" id="login-button">Login</button>
				</form>
			</div>
	  </div>
        </div>
         <script type="text/javascript" th:src="@{/base/login/js/jquery-2.1.1.min.js}"></script>
        <!-- Javascript -->
        <script th:src="@{/base/layui/layui.js}"></script>
        <script th:src="@{/base/login/assets/js/jquery-1.8.2.min.js}"></script>
        <script th:src="@{/base/login/assets/js/supersized.3.2.7.min.js}"></script>
        <script th:src="@{/base/login/assets/js/supersized-init.js}"></script>
        <script th:src="@{/base/login/assets/js/scripts.js}"></script>
</body>
<script type="text/javascript">
layui.use(['layer', 'form'], function() {
    var layer = layui.layer,
        $ = layui.jquery,
        form = layui.form;
		
    form.on('submit(login)', function(data){
      $.post('/system/login.do',data.field,function(res){
    	if(res.status==200) {
    		document.location.href = "/container";
    	} else {
    		var number = parseInt(Math.random()*10);
    		if(number % 2 == 0) {
    			layer.tips(res.msg,'#username');
    		} else {
    			layer.tips(res.msg,'#password');
    		}
    	}
    	});
    	return false;
    });
});
</script>
</html>